<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String ctx = request.getContextPath();
    request.setAttribute("ctx", ctx);
%>
<html>
<head>
    <title>Title</title>
    <script src="${ctx}/bootstrap/jquery-1.9.1.min.js"></script>
    <link rel="stylesheet" href="${ctx}/css/index_work.css">
</head>
<body>
<form action="${ctx}/list.do">
    <input type="hidden" name="pageNum">
    价格范围：<input type="text" name="pricestart" value="${goods.pricestart}">-<input type="text" name="priceend" value="${goods.priceend}">
    已销售百分比：<input type="text" name="salesstart" value="${goods.salesstart}">-<input type="text" name="salesend" value="${goods.salesend}">
    排序：<select name="orderfield">
    <option value="id" <c:if test="${goods.orderfield=='id'}">selected</c:if> >id</option>
    <option value="name" <c:if test="${goods.orderfield=='name'}">selected</c:if> >名称</option>
    <option value="price" <c:if test="${goods.orderfield=='price'}">selected</c:if> >价格</option>
    <option value="sales" <c:if test="${goods.orderfield=='sales'}">selected</c:if> >百分比</option>
</select>
    <select name="ordertype">
        <option value="asc">正序</option>
        <option value="desc">倒序</option>
    </select>
    <input type="submit" value="查询">
</form>
<table>
    <tr>
        <td>id</td>
        <td>名称</td>
        <td>价格</td>
        <td>百分比</td>
    </tr>
    <c:forEach items="${pageInfo.list}" var="var">
        <tr>
            <td>${var.id}</td>
            <td>${var.name}</td>
            <td>￥${var.price}</td>
            <td>${var.sales}%</td>
        </tr>
    </c:forEach>
</table>
<a href="##" onclick="fenye(1)">首页</a>
<a href="##" onclick="fenye(${pageInfo.prePage})">上一页</a>
<a href="##" onclick="fenye(${pageInfo.nextPage})">下一页</a>
<a href="##" onclick="fenye(${pageInfo.pages})">尾页</a>
共${pageInfo.total}条数据
<script>
    function fenye(pageNum) {
        $("[name='pageNum']").val(pageNum);
        $("form").submit();
    }
    $("[name='ordertype']").val("${goods.ordertype}");
</script>
</body>
</html>
